import { defineStore } from "pinia";
import { reactive } from "vue";
import type { studentInfo } from "@/api/type";
export const useStudentStore = defineStore("student", {
  state: () => {
    return {
      // token: "",
      studentInfo: reactive<studentInfo>({}),
    };
  },
  actions: {
    // studentLogin(newToken: string) {
    //   this.token = newToken;
    // },
    studentLogout() {
      // 目前没有mock接口退出登录（通知服务器本次token失效）
      // this.token = "";
      this.studentInfo = <studentInfo>{};
    },
    setStudentInfo(user: any) {
      this.studentInfo = user;
    },
  },
  getters: {
    // 可以添加 getter 方法
  },
  persist: true,
});
